/*
 * Hyuga: A Density-Grid Stream Clustering Platform.
 * Copyright (C) 2014 PUC-Rio/Laboratory for Advanced Collaboration
 *
 * Hyuga is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Hyuga is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Hyuga.  If not, see <http://www.gnu.org/licenses/>.
 */
package br.pucrio.inf.lac.konoha.hyuga.events.cell;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import br.pucrio.inf.lac.konoha.hyuga.events.CEPEvent;

/**
 * Represent a context partition dispersion cluster event. This event is generated if a {@link CellClusterEvent} is not
 * followed by another one within 2Δ seconds. If the context partition does not generate a following cluster event
 * within this period, it means that the number of location updates mapped to the context partition is no longer larger
 * than minPts, and, thus, no longer constitutes a cluster. We consider a time period of 2Δ, instead of just Δ, in 
 * order to tolerate the situation where the location updates mapped to the partition are generated out of sync by the 
 * corresponding mobile nodes.
 * 
 * @author Marcos Roriz <mroriz@inf.puc-rio.br>
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class CellDisperseEvent extends CEPEvent {
	// (Cell) Partition Identifiers
	private int x;
	private int y;

	// Timestamp
	private long timestamp;
    
    // Distributed Flag
    private boolean distributed;

    // Empty Constructor
	public CellDisperseEvent() {
	    this(0, 0);
	}

	// Default Constructor
	public CellDisperseEvent(int x, int y) {
		this(x, y, System.currentTimeMillis());
	}

	// Distributed Constructor
    public CellDisperseEvent(int x, int y, boolean distributed) {
        this(x, y, System.currentTimeMillis());
        
        this.distributed = distributed;
    }

    
    // Default Constructor
    public CellDisperseEvent(int x, int y, long timestamp) {
        this.x = x;
        this.y = y;
        this.timestamp = timestamp;
        
        // TYPE
        this.type = TYPE.CELLDISPERSE;
        this.distributed = false;
    }

	//////////////////////////////////////////////////////////////////////////
    // Gets and Sets
    //////////////////////////////////////////////////////////////////////////

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }
	public long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
	
	public boolean isDistributed() {
        return distributed;
    }

    public void setDistributed(boolean distributed) {
        this.distributed = distributed;
    }

}
